]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Make "gnome-shell --create-extension" compatible with Python 2.5
authorSiegfried-Angel Gevatter Pujals <rainct@ubuntu.com>
Fri, 18 Dec 2009 19:22:51 +0000 (20:22 +0100)
committerSiegfried-Angel Gevatter Pujals <rainct@ubuntu.com>
Fri, 18 Dec 2009 19:22:51 +0000 (20:22 +0100)
Fallback to using the json-py module on systems with a Python
version older than 2.6 (which introduced native JSON support).

src/gnome-shell.in

index 62c86d604d722ed9443f210a3f822f7fedf2b320..2142c8f02ab9946a4888e774bdf5231d13eda448 100644 (file)
@@ -260,7 +260,11 @@ use an extension title clicktofocus@janedoe.example.com.'''
              'description': description,
              'uuid': uuid }
     f = open(os.path.join(extension_path, 'metadata.json'), 'w')
-    json.dump(meta, f)
+    try:
+        json.dump(meta, f)
+    except AttributeError:
+        # For Python versions older than 2.6, try using the json-py module
+        f.write(json.write(meta) + '\n')
     f.close()
 
     extensionjs_path = os.path.join(extension_path, 'extension.js')